package GUI;

import java.awt.BorderLayout;
import java.awt.Graphics2D;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import java.awt.Transparency;

import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;

import Entita.Tavola;

public class VisualizzaTavolaLocalizzazione extends JFrame {

	private class TurnButton extends JButton{
		/**
		 * 
		 */
		private static final long serialVersionUID = 1L;
		private JFrame finestra;
		public TurnButton(String arg0, JFrame finestra) {
			super(arg0);
			this.finestra=finestra;
		}
		public JFrame getFinestra() {
			return finestra;
		}
		
	}
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JPanel contentPane;
	private JLabel label;
	private ImageIcon immagine;


	
	/**
	 * Create the frame.
	 */
	public VisualizzaTavolaLocalizzazione(Tavola tavola) {

		setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
		this.setTitle("Tavola " + tavola.getNumeroLocalizzazioni());
		immagine=new ImageIcon(tavola.getImmagineLocalizzazione());
		int maxDimension = Math.max(immagine.getIconHeight(),immagine.getIconWidth());
		contentPane = new JPanel();
		int height=Toolkit.getDefaultToolkit().getScreenSize().height;
		int width=Toolkit.getDefaultToolkit().getScreenSize().width;
		this.setLocation(width/2-immagine.getIconWidth()/2+50, height/2-immagine.getIconHeight()/2);
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setLayout(new BorderLayout(0, 0));
		this.setTitle(tavola.toString());
		this.setResizable(false);


		setContentPane(contentPane);
		

		
		
		label=new JLabel(immagine);
		label.setBounds(0, 0, maxDimension, maxDimension);
		
		contentPane.add(label,BorderLayout.CENTER);
		
		
		JPanel pannelloBottoni = new JPanel();
		contentPane.add(pannelloBottoni, BorderLayout.SOUTH);
		

		
		
		pack();
	}
}
